package com.heima.feigns;

import com.heima.feigns.fallback.ApArticleClientFallback;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "leadnews-article", fallbackFactory = ApArticleClientFallback.class)
public interface ApArticleClient {
    @PostMapping("api/v1/article/save")
    public ResponseResult saveArticle(@RequestBody ArticleDto articleDto);

    @GetMapping("api/v1/article/findOneById/{id}")
    public ResponseResult findOneById(@PathVariable("id") long articleId);

    @GetMapping("api/v1/article/findAll")
    public ResponseResult findAll();


    @GetMapping("api/v1/article/selectFiveDaysArticle")
    public ResponseResult selectFiveDaysArticle();
}
